<template>
	<view class="detail_box wp">
	    <view class="titleTime ">
	        <text class="title multiColumn">{{ title }}</text>
	        <text class="time">{{ info.createdAt }}</text>
	    </view>
	    <text class="context">{{ info.content }}</text>
	</view>
</template>

<script>
	import request from "@/api/index.js";
	
	export default {
		data() {
			return {
				 id: 0,
				 title: '',
				 info: []
			}
		},
		
		onLoad(options) {
			var id = options.id;
			var title = options.title;
			
			if(id){
				this.title = title;
				this.getMessageDetail(id, info => {
					this.info = info;
				})
			}else{
				uni.showToast({
					title: 'ID缺失',
					icon: 'none'
				})
				
				setTimeout(function(){
					uni.navigateBack();
				},500)
			}
		},
		
		methods: {
			getMessageDetail: function (id, callback){
				var url = 'shop/store-api/'+ uni.getStorageSync('shop_id') +'/frontMessage/'+ id + '/read'
				
				request.http(url, 'POST').then(res => {
					var data = res.data;
					if (data.code == 0) {
						var list = data.data;
						callback(list);
					}
				})
			},
		}
	}
</script>

<style src="../../static/css/app.css"></style>
<style>
	
	page{
	    background-color: #fff;
	}
	.title{
	    font-size: 32rpx;
	    font-family: PingFang;
	    font-weight: bold;
	    color: #333333;
	    line-height: 48rpx;
	    margin-top: 32rpx;
	    margin-bottom: 12rpx;
	}
	.time{
	    font-size: 20rpx;
	    color: #999999;
	    line-height: 20rpx;
	    margin-bottom: 40rpx;
	}
	.mImg{
	    height: 215rpx;
	    width: 100%;
	    margin-bottom: 8rpx;
	}
	.context{
	
	    color: #333333;
	    line-height: 48rpx;
	}
</style>
